home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _CCDEB879F6C148E5AB329B5F45B3AA6B < prev    next >
Encoding:
Text File  |  2004-01-06  |  1.6 KB  |  59 lines

  1. -- observe behaviour - 
  2. -- Created by Sten; 18-09-2002
  3. -- Modified by Petar; 
  4. --------------------------
  5.  
  6.  
  7. AIBehaviour.Job_Observe = {
  8.     Name = "Job_Observe",
  9.     JOB = 1,
  10.     
  11.     -- SYSTEM EVENTS            -----
  12.     ---------------------------------------------
  13.     OnSpawn = function(self,entity )
  14.         entity:InitAIRelaxed();
  15.     
  16.         local dh=entity:GetName().."_OBSERVE";
  17.  
  18.         -- try to get tagpoint of the same name as yourself first
  19.         local TagPoint = Game:GetTagPoint(dh);
  20.          if (TagPoint==nil) then
  21.             -- try to fish for a observation anhor within 2 meter from yourself
  22.             dh = AI:FindObjectOfType(entity.id,20,AIAnchor.AIANCHOR_OBSERVE);
  23.         end
  24.         
  25.         entity:SelectPipe(0,"observe_direction",dh);
  26.         if (TagPoint or dh) then
  27.             entity:InsertSubpipe(0,"patrol_approach_to",dh);
  28.         end
  29.         entity:InsertSubpipe(0,"setup_idle");    -- get in correct stance
  30.     end,
  31.  
  32.     OnJobContinue = function(self,entity,sender)
  33.         self:OnSpawn(entity);
  34.     end,
  35.     ----------------------------------------------------    
  36.     OnBored = function (self, entity)
  37.         entity:MakeRandomConversation();
  38.         entity.cnt:CounterSetValue("Boredom", 0 );
  39.     end,
  40.     ----------------------------------------------------FUNCTIONS 
  41. --    DO_SOMETHING_IDLE = function (self, entity, sender)
  42. --        local rnd = random(1,10);
  43. --        if (rnd > 7) then 
  44. --            if (entity:DoSomethingInteresting() == nil) then
  45. --                entity:MakeRandomIdleAnimation();
  46. --            end
  47. --        else
  48. --            entity:MakeRandomIdleAnimation();
  49. --        end
  50. --    end,
  51.  
  52.     FOLLOW_ME = function (self, entity, sender)
  53.         entity:SelectPipe(0,"simple_follow");
  54.         entity:InsertSubpipe(0,"follow_leader");
  55.         
  56.     end,
  57.  
  58.  
  59. }